﻿namespace Beetle
{
    using System;
    using System.IO;
    using System.Runtime.CompilerServices;
    using System.Security.Cryptography;
    using System.Text;

    public class LICENSE
    {
        private static LICENSE _field_a = null;
        private static RSACryptoServiceProvider _field_b = new RSACryptoServiceProvider(0x800);
        [CompilerGenerated]
        private string _field_c;
        [CompilerGenerated]
        private string _field_d;
        [CompilerGenerated]
        private DateTime _field_e;
        [CompilerGenerated]
        private int _field_f;

        internal static byte[] a(byte[] A_0)
        {
            return _field_b.Decrypt(A_0, false);
        }

        internal static string a(string A_0)
        {
            return Encoding.UTF8.GetString(a(Convert.FromBase64String(A_0)));
        }

        internal static bool a(string A_0, string A_1)
        {
            return a(Encoding.UTF8.GetBytes(A_0), Convert.FromBase64String(A_1));
        }

        internal static bool a(byte[] A_0, byte[] A_1)
        {
            return _field_b.VerifyData(A_0, "MD5", A_1);
        }

        internal static string b(string A_0)
        {
            return Convert.ToBase64String(b(Encoding.UTF8.GetBytes(A_0)));
        }

        internal static byte[] b(byte[] A_0)
        {
            return _field_b.Encrypt(A_0, false);
        }

        public static LICENSE GetLICENSE()
        {
            lock (typeof(LICENSE))
            {
                if (_field_a == null)
                {
                    _field_a = new LICENSE();
                    try
                    {
                        _field_b.FromXmlString("<RSAKeyValue><Modulus>xMh2P+GtfFALDFPup8VyRjbwrbDwWHdC6mqVS9OmyWr0laCw/jH4Sdm3nFlYge/4x/13/Ysn8BCICpzlMxA1LrIbxSwGu6gfEcjf3rP6rEtaSnjY+sYS8KoU3UJJxTOMJjowEI0cXwSbVxCSvoWhe8BIaFXnD5QrEErM0XH1JZdByR2kqctJdCX6JeG4uNkrTWo/S9ubQTxlTXHXUMRwx010cUMlzwjeKKANtew8yurQORF1pjxAmK8Xqd0q9cOYiRibq+oLm1yKcp2a/86Jc2dmB+bddQ0EntZQ7p0iKw2qGXn25RL4WFW7LH8wblkEX1JytTQ/iApPryNzCgvwqqohrGFVnsJpiklJyBqSQqigbZgTgY40PfX9jLxmATH0/cTrIm0NIgb5Z8iPyMmhDsxae6aGGIV8yOQxPn4XrMV4fi+5e8n7BnPxJkGEJrzfIPLvZNMDUjFbN6g0hZacnfkfN8U=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>");
                        using (StreamReader reader = new StreamReader(TcpUtils.g() + "license.sn"))
                        {
                            string[] strArray = reader.ReadToEnd().Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                            if (a(strArray[0], strArray[1]))
                            {
                                string[] strArray2 = Encoding.UTF8.GetString(Convert.FromBase64String(strArray[0])).Split(new char[] { ';' });
                                _field_a.Company = strArray2[0];
                                _field_a.EMail = strArray2[1];
                                _field_a.MaxConnections = int.Parse(strArray2[2]);
                                _field_a.ValidDate = new DateTime(long.Parse(strArray2[3]));
                            }
                        }
                    }
                    catch (Exception exception)
                    {
                        string message = exception.Message;
                    }
                }
            }
            return _field_a;
        }

        public override string ToString()
        {
            StringBuilder builder = new StringBuilder();
            builder.AppendFormat("Version:{0}\r\n", base.GetType().Assembly.GetName().Version);
            builder.AppendFormat("Company:{0}\r\n", this.Company);
            builder.AppendFormat("EMail:{0}\r\n", this.EMail);
            builder.AppendFormat("ValidDate:{0}\r\n", this.ValidDate);
            builder.AppendFormat("MaxConnections:{0}\r\n", this.MaxConnections);
            return builder.ToString();
        }

        public string Company
        {
            [CompilerGenerated]
            get
            {
                return this._field_c;
            }
            [CompilerGenerated]
            set
            {
                this._field_c = value;
            }
        }

        public string EMail
        {
            [CompilerGenerated]
            get
            {
                return this._field_d;
            }
            [CompilerGenerated]
            set
            {
                this._field_d = value;
            }
        }

        public int MaxConnections
        {
            [CompilerGenerated]
            get
            {
                return this._field_f;
            }
            [CompilerGenerated]
            set
            {
                this._field_f = value;
            }
        }

        public DateTime ValidDate
        {
            [CompilerGenerated]
            get
            {
                return this._field_e;
            }
            [CompilerGenerated]
            set
            {
                this._field_e = value;
            }
        }
    }
}

